var express = require('express');
var router = express.Router();

const db = require("../public/javascripts/db")

/* GET home page. */
router.post('/', function(req, res, next) {
    let info = req.body;
    let sql = "insert into express set ?"
    info.express_time = new Date();
    db(sql, info, (result)=>{
        if(result.affectedRows == 1){
            res.json({
                code:200,
                message:"添加成功"
            })
        }else{
            res.json({
                code:201,
                message:"添加失败"
            })
        }
    })
});

module.exports = router;